import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Jiang Jinxi
 * Date: 2024-09-02
 * Time: 11:51
 */
public class Demo27 {
    public static void main(String[] args) {
        ExecutorService service = Executors.newCachedThreadPool();
        for(int i = 0; i < 1000; i++){
            int id = i;
            service.submit(new Runnable() {
                @Override
                public void run() {
                    System.out.println("hello " + id + " " + Thread.currentThread().getName());
                }
            });
        }

        //ExecutorService service1 = Executors.newFixedThreadPool(100);
        //ExecutorService service2 = Executors.newSingleThreadExecutor();
        //ExecutorService service3 = Executors.newScheduledThreadPool(4);
    }
}
